<?php

require_once('../../config.php');

/**
 * @todo: Der Inhalt der Variable $currencyCode darf nicht "hartkodiert" sein.
 */
$productId = intval($_GET['productId']);
$quantity = intval($_GET['quantity']);
$currencyCode = 'CHF';

if($productId > 0) {
	if($quantity > 0) {
		require_once(WSB_MODULES_PATH .'sherpa/models/BasketGateway.php');
		$gateway = new Sherpa_Model_BasketGateway();
		$affectedRows = $gateway->addProduct($productId, $quantity, $currencyCode);
		$success = empty($affectedRows) ? false : true;

		header('Content-type: application/json');
		echo Zend_Json::encode($success);
		exit;
	}
}

header( 'HTTP/1.1 404 Not Found' );